package com.mjw.zstu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mjw.zstu.VO.ExhibitionCompanyVO;
import com.mjw.zstu.entity.Exhibition;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public interface ExhibitonMapper extends BaseMapper<Exhibition> {
 @Select("SELECT exhibition.* ,company.is_review as company_is_review," +
         "company.avatar_img,company.company_id,company.emergency_people,company.phone,company.emergency_contact,company_name," +
         "company.company_address FROM exhibition,company WHERE exhibition.company_id=company.company_id AND company_id=#{company_id}")
         public List<Map> CompanyExhibiton(int company_id);
 @Select("SELECT exhibition.* ,company.is_review as company_is_review," +
         "company.avatar_img,company.company_id,company.emergency_people,company.phone,company.emergency_contact,company_name," +
         "company.company_address FROM exhibition,company WHERE exhibition.company_id=company.company_id AND exhibition.start_time<#{end_time} AND exhibition.end_time>#{start_time}")
    public List<Map> getTodayExhibition(long start_time,long end_time);

    //获取非轮播
    @Select("select exhibition.*, company.company_name,company.emergency_people,company.emergency_contact,company.phone from exhibition,company where exhibition.company_id=company.company_id and exhibition.is_review=1 and exhibition.is_banner_recommend=0 and exhibition.is_recommend=0")
    public List<Map> getnotBanner();
    @Select("select exhibition.*, company.company_name,company.emergency_people,company.emergency_contact,company.phone from exhibition,company where exhibition.company_id=company.company_id  and exhibition.is_banner_recommend=1")
    public List<Map> getbanner();
    //获取非推荐
    @Select("select exhibition.*, company.company_name,company.emergency_people,company.emergency_contact,company.phone from exhibition,company where exhibition.company_id=company.company_id and exhibition.is_review=1 and exhibition.is_banner_recommend=0 and exhibition.is_recommend=0 and (exhibition.admin_recommend=0 or exhibition.admin_recommend=2)")
    public List<Map> gettnorecommend();
    @Select("select exhibition.*, company.company_name,company.emergency_people,company.emergency_contact,company.phone from exhibition,company where exhibition.company_id=company.company_id and exhibition.is_review=1  and (exhibition.is_recommend=1 or exhibition.admin_recommend=1)")
    public List<Map> getrecommend();
    @Select("select count(*) as value,type_id from exhibition group by type_id order by value limit 0,5")
    public List<Map> pieEx();

}
